import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    isCollapse: false,
    breadcrumb: [{
      path: '/',
      name: 'home',
      label: '首页',
      icon: 's-home',
      url: 'Home/Home'
    }]
  },
  getters: {
  },
  mutations: {
    collapsMenu(state) {
      state.isCollapse = !state.isCollapse
    },
    selectMenu(state, val) {
      if (val.name !== 'home') {
         const index = state.breadcrumb.findIndex(item=>item.name ===val.name)
         if(index === -1){
          state.breadcrumb.push(val)
         }
      }
    }

  },
  actions: {
  },
  modules: {
  }
})
